{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "from KNN.lr import LinearRegression3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_train=np.random.random(size=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_train = x_train * 2.8 + .5 + np.random.normal(size=len(x_train))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x10dbecc88>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD8CAYAAABjAo9vAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGZtJREFUeJzt3X+MpVddx/HPd6dTmSIyaEehU5YtBqrQBhZvtGQThIJspfxYG1RQ/JEQN6ASEV2zFSMFQ7q6CqKSyEYIovwoP8qyUHQFtw3a2NJZZ9vttq5BaKHTxg6hUyEdcbr79Y97p53O3h/Pvc95nuec87xfySbz4+5zz3PvPN97zvd8z3nM3QUAyMeWphsAAAiLwA4AmSGwA0BmCOwAkBkCOwBkhsAOAJkhsANAZgjsAJAZAjsAZOasJp703HPP9W3btjXx1ACQrKNHj37T3edGPa6RwL5t2zYtLCw08dQAkCwzu7vI40jFAEBmCOwAkBkCOwBkhsAOAJkhsANAZgjsAJCZRsodASAXBxeXtP/wSd27sqrzZme0Z+eF2rV9vtE2EdgB1CbGIFjGwcUlXXntca2unZIkLa2s6sprj0tSo+cVJBVjZ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893o9er2AFI18nzNbLukp7r75+psWEWKvL/PlPRMM7vRzG4ys8tqa114Rc73KkmvM7N7JH1e0pvqaVojxr2+J1bq1ng16Nfz3lzGU+QxqSh8Lmb2OkkdST9ZaYuqNfR8zWyLpHdL+tW6GlSxIu/vWeqmY16o7mjsX8zsIndfqbhtVShyvq+V9EF3/zMze76kv+ud7+nqm1e72mJV7D32eyQ9dcP35+vModojjzGzs9Qdzg0bDsWsyPnKzF4i6a2SXunu362pbVUYdb5PkHSRpBvM7C5185KHEp5ALfr3/Bl3X3P3r0k6qW6gT1GR8329pI9Lkrv/m6THqbuvSo4KXd8hxB7Yb5H0DDO7wMzOVndy9NCmxxyS9Cu9r18t6Yj3ZioSNPJ8e6mJ96kb1FPOv0ojztfdH3T3c919m7tvU3dO4ZXunuoNc4v8PR9Ud4JcZnauuqmZr9baynCKnO/XJb1YkszsR9UN7Mu1trI+hyT9cq865hJJD7r7fZU8U9MzyQVmml8m6T/VnV1/a+9n71D3Ape6fwifkPQVSV+W9PSm21zx+X5R0n9LOtb7d6jpNld5vpsee4MSroop+P6apHdJukPScUmvabrNFZ/vsyTdqG7FzDFJL226zSXO9aOS7pO0pm7v/PWS3iDpDRve2/f2XovjVf4ts/IUADITeyoGADAmAjsAZIbADgCZIbADQGYI7ACQGQI7AGSGwA4AmSGwA0Bm/h+ZUZM7BcERagAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x109261550>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def J(X_b,y_train,theta):\n",
    "    try:\n",
    "        return np.sum((X_b.dot(theta)-y_train)**2)/len(X_b)\n",
    "    except:\n",
    "        return float(\"inf\")\n",
    "    \n",
    "def dJ(X_b,y_train,theta):\n",
    "    dt=np.empty(len(theta))\n",
    "    dt[0] = np.sum(X_b.dot(theta) - y_train)\n",
    "    for i in range(1,len(theta)):\n",
    "        dt[i] = np.sum((X_b.dot(theta) - y_train).dot(X_b[:,i]))\n",
    "    return 2*dt/len(X_b)\n",
    "def grediant_vector(X_b,y_train,theta,eta=0.01,epsilon=1e-8,n_iter=1e4):\n",
    "    m_iter = 0\n",
    "    while m_iter<n_iter:\n",
    "        last_theta = theta\n",
    "        theta = theta - eta * dJ(X_b,y_train,theta)\n",
    "        if np.absolute(J(X_b,y_train,theta) - J(X_b,y_train,last_theta)) <= epsilon:\n",
    "            break\n",
    "        m_iter += 1\n",
    "    return theta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.58920139, 2.68275652])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train=x_train.reshape(100,-1)\n",
    "X_b=np.hstack([np.ones(shape=(len(X_train),1)),X_train])\n",
    "theta=np.zeros(X_b.shape[1])\n",
    "grediant_vector(X_b,y_train,theta)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression3"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train=x_train.reshape(100,-1)\n",
    "lr3=LinearRegression3()\n",
    "lr3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression3"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr3.fit_gd(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5892013867507152"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr3.intercept_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.68275652])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr3.k_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
